#! /usr/bin/env node
import inquirer from 'inquirer'
import {program} from 'commander'
import create from './lib/create.js'

const promptList = [
    {
        type: 'checkbox',
        message: '选择模块',
        name: 'modules',
        choices: [
            "ts",
            "eslint",
            "webpack"
        ]
    }
]
const inquirerRes =await inquirer.prompt(promptList)
console.log('inquirerRes',inquirerRes)
program
    .command('create <appname>') //其中<>代表必填 []代表可选
    .option('-f,--force', '描述性文字')
    .description('创建一个新的项目')
    .action(async (name, options) => {
        console.log('项目名是：', name, 'options:', options);
        await create(name, options)
    })
program.parse(process.argv)// 解析用户执行命令传入参数
